Perturb key technique

ABSTRACT

A technique perturbs an extent key to compute a candidate extent key in the event of a collision with metadata (i.e., two extents having different data that yield identical hash values) stored in a memory of a node in a cluster. The perturbing technique may be used to compute a candidate extent key that is not previously stored in an extent store instance. The candidate extent key may be computed from a hash value of an extent using a perturbing algorithm, i.e., a hash collision computation, which illustratively adds a perturb value to the hash value. The perturb value is illustratively sufficient to ensure that the candidate extent key resolves to a same hash bucket and node (extent store instance) as the original extent key. In essence, the technique ensures that the original extent key is perturbed in a deterministic manner to generate the candidate extent key, so that the original extent and candidate extent key “decode” to the same hash bucket and extent store instance.

RELATED APPLICATION

The present application claims priority from commonly owned ProvisionalPatent Application No. 62/120,809, entitled PERTURB KEY TECHNIQUE, filedon Feb. 25, 2015, the contents of which are incorporated herein byreference.

BACKGROUND

1. Technical Field

The present disclosure relates to storage systems and, morespecifically, to a metadata organization for efficient storage andretrieval of data in a storage system.

2. Background Information

A storage system typically includes one or more storage devices, such asdisks embodied as hard disk drives (HDDs) or solid state drives (SSDs),into which information may be entered, and from which information may beobtained, as desired. The storage system may implement a high-levelmodule, such as a file system, to logically organize the informationstored on the disks as storage containers, such as files or logicalunits (LUNs). Each storage container may be implemented as a set of datastructures, such as data blocks that store data for the storagecontainers and metadata blocks that describe the data of the storagecontainers. For example, the metadata may describe, e.g., identify,storage locations on the disks for the data.

In a traditional file system, large amounts of metadata updates(changes) may be incurred when processing input/output (I/O) requests,such as read or write requests. That is, a relatively large amount ofmetadata may be written in proportion to an amount of data (to bewritten) for the associated I/O request(s), i.e., high writeamplification. The use of hashing in a file system may reduce the amountof metadata needed to process the I/O request(s), as well as reduce theamount of metadata stored in a memory of the storage system. By reducingthe amount of metadata needed to process the I/O requests andmaintaining a substantial amount of that needed metadata in the memory,e.g., RAM, of the storage system, the amount of disk accesses (read andwrite) may be reduced, thus reducing both read and write amplification.However, collisions may occur with the metadata that require resolution,particularly where metadata is selected using a hash function. Thusthere is need for an efficient technique to resolve hash collisionswhere metadata is selected using the hash.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and further advantages of the embodiments herein may be betterunderstood by referring to the following description in conjunction withthe accompanying drawings in which like reference numerals indicateidentically or functionally similar elements, of which:

FIG. 1 is a block diagram of a plurality of nodes interconnected as acluster;

FIG. 2 is a block diagram of a node;

FIG. 3 is a block diagram of a storage input/output (I/O) stack of thenode;

FIG. 4 illustrates a write path of the storage I/O stack;

FIG. 5 illustrates a read path of the storage I/O stack;

FIG. 6 is a block diagram of an extent hashing technique;

FIG. 7 is a block diagram of a bucket mapping technique;

FIG. 8a is a block diagram of a hash table entry selection technique;

FIG. 8b is a block diagram of a hash table slot;

FIG. 9 is a block diagram of an extent key reconstruction technique; and

FIG. 10 is a block diagram of a perturb key technique.

OVERVIEW

The embodiments described herein are directed to a technique forperturbing an original extent key to compute a candidate extent key inthe event of a collision with metadata stored in a memory of a node in acluster. The perturbing technique may be used to compute a candidateextent key that is not previously stored in an extent store instance.The candidate extent key may be computed from a hash value of an extentusing a perturbing algorithm, i.e., a hash collision computation, whichillustratively adds a perturb value to the hash value. The perturb valueis illustratively sufficient to ensure that the candidate extent keyresolves to the same node (extent store instance) and hash table as theoriginal extent key. In essence, the technique ensures that the originalextent key is perturbed in a predictable manner to generate thecandidate extent key, so that the original extent and candidate extentkey “decode” to the same hash table and extent store instance.

Description

Storage Cluster

FIG. 1 is a block diagram of a plurality of nodes 200 interconnected asa cluster 100 and configured to provide storage service relating to theorganization of information on storage devices. The nodes 200 may beinterconnected by a cluster interconnect fabric 110 and includefunctional components that cooperate to provide a distributed storagearchitecture of the cluster 100, which may be deployed in a storage areanetwork (SAN). As described herein, the components of each node 200include hardware and software functionality that enable the node toconnect to one or more hosts 120 over a computer network 130, as well asto one or more storage arrays 150 of storage devices over a storageinterconnect 140, to thereby render the storage service in accordancewith the distributed storage architecture.

Each host 120 may be embodied as a general-purpose computer configuredto interact with any node 200 in accordance with a client/server modelof information delivery. That is, the client (host) may request theservices of the node, and the node may return the results of theservices requested by the host, by exchanging packets over the network130. The host may issue packets including file-based access protocols,such as the Network File System (NFS) protocol over the TransmissionControl Protocol/Internet Protocol (TCP/IP), when accessing informationon the node in the form of storage containers such as files anddirectories. However, in an embodiment, the host 120 illustrativelyissues packets including block-based access protocols, such as the SmallComputer Systems Interface (SCSI) protocol encapsulated over TCP (iSCSI)and SCSI encapsulated over FC (FCP), when accessing information in theform of storage containers such as logical units (LUNs). Notably, any ofthe nodes 200 may service a request directed to a storage containerstored on the cluster 100.

FIG. 2 is a block diagram of a node 200 that is illustratively embodiedas a storage system having one or more central processing units (CPUs)210 coupled to a memory 220 via a memory bus 215. The CPU 210 is alsocoupled to a network adapter 230, storage controllers 240, a clusterinterconnect interface 250 and a non-volatile random access memory(NVRAM 280) via a system interconnect 270. The network adapter 230 mayinclude one or more ports adapted to couple the node 200 to the host(s)120 over computer network 130, which may include point-to-point links,wide area networks, virtual private networks implemented over a publicnetwork (Internet) or a local area network. The network adapter 230 thusincludes the mechanical, electrical and signaling circuitry needed toconnect the node to the network 130, which illustratively embodies anEthernet or Fibre Channel (FC) network.

The memory 220 may include memory locations that are addressable by theCPU 210 for storing software programs and data structures associatedwith the embodiments described herein. The CPU 210 may, in turn, includeprocessing elements and/or logic circuitry configured to execute thesoftware programs, such as a storage input/output (I/O) stack 300, andmanipulate the data structures. Illustratively, the storage I/O stack300 may be implemented as a set of user mode processes that may bedecomposed into a plurality of threads. An operating system kernel 224,portions of which are typically resident in memory 220 (in-core) andexecuted by the processing elements (i.e., CPU 210), functionallyorganizes the node by, inter alia, invoking operations in support of thestorage service implemented by the node and, in particular, the storageI/O stack 300. A suitable operating system kernel 224 may include ageneral-purpose operating system, such as the UNIX® series or MicrosoftWindows® series of operating systems, or an operating system withconfigurable functionality such as microkernels and embedded kernels.However, in an embodiment described herein, the operating system kernelis illustratively the Linux® operating system. It will be apparent tothose skilled in the art that other processing and memory means,including various computer readable media, may be used to store andexecute program instructions pertaining to the embodiments herein.

Each storage controller 240 cooperates with the storage I/O stack 300executing on the node 200 to access information requested by the host120. The information is preferably stored on storage devices such assolid state drives (SSDs) 260, illustratively embodied as flash storagedevices, of storage array 150. In an embodiment, the flash storagedevices may be based on NAND flash components, e.g., single-layer-cell(SLC) flash, multi-layer-cell (MLC) flash or triple-layer-cell (TLC)flash, although it will be understood to those skilled in the art thatother non-volatile, solid-state electronic devices (e.g., drives basedon storage class memory components) may be advantageously used with theembodiments described herein. Accordingly, the storage devices may ormay not be block-oriented (i.e., accessed as blocks). The storagecontroller 240 includes one or more ports having I/O interface circuitrythat couples to the SSDs 260 over the storage interconnect 140,illustratively embodied as a serial attached SCSI (SAS) topology.Alternatively, other point-to-point I/O interconnect arrangements, suchas a conventional serial ATA (SATA) topology or a PCI topology, may beused. The system interconnect 270 may also couple the node 200 to alocal service storage device 248, such as an SSD, configured to locallystore cluster-related configuration information, e.g., as clusterdatabase (DB) 244, which may be replicated to the other nodes 200 in thecluster 100. The cluster interconnect interface 250 may include one ormore ports adapted to couple the node 200 to the other node(s) of thecluster 100. In an embodiment, Ethernet may be used as the clusteringprotocol and interconnect fabric media, although it will be apparent tothose skilled in the art that other types of protocols andinterconnects, such as Infiniband, may be utilized within theembodiments described herein. The NVRAM 280 may include a back-upbattery or other built-in last-state retention capability (e.g.,non-volatile semiconductor memory, such as storage class memory) that iscapable of maintaining data in light of a failure to the node andcluster environment. Illustratively, a portion of the NVRAM 280 may beconfigured as one or more non-volatile log (NVLogs 285) configured totemporarily record (“log”) I/O requests, such as write requests,received from the host 120.

Storage I/O Stack

FIG. 3 is a block diagram of the storage I/O stack 300 that may beadvantageously used with one or more embodiments described herein. Thestorage I/O stack 300 includes a plurality of software modules or layersthat cooperate with other functional components of the nodes 200 toprovide the distributed storage architecture of the cluster 100. In anembodiment, the distributed storage architecture presents an abstractionof a single storage container, i.e., all of the storage arrays 150 ofthe nodes 200 for the entire cluster 100 organized as one large pool ofstorage. In other words, the architecture consolidates storage, i.e.,the SSDs 260 of the arrays 150, throughout the cluster (retrievable viacluster-wide keys) to enable storage of the LUNs. Both storage capacityand performance may then be subsequently scaled by adding nodes 200 tothe cluster 100.

Illustratively, the storage I/O stack 300 includes an administrationlayer 310, a protocol layer 320, a persistence layer 330, a volume layer340, an extent store layer 350, is a Redundant Array of IndependentDisks (RAID) storage layer 360, a storage layer 365 and a NVRAM (storingNVLogs) “layer” interconnected with a messaging kernel 370. Themessaging kernel 370 may provide a message-based (or event-based)scheduling model (e.g., asynchronous scheduling) that employs messagesas fundamental units of work exchanged (i.e., passed) among the layers.Suitable message-passing mechanisms provided by the messaging kernel totransfer information between the layers of the storage I/O stack 300 mayinclude, e.g., for intra-node communication: i) messages that execute ona pool of threads, ii) messages that execute on a single threadprogressing as an operation through the storage I/O stack, iii) messagesusing an Inter Process Communication (IPC) mechanism and, e.g., forinter-node communication: messages using a Remote Procedure Call (RPC)mechanism in accordance with a function shipping implementation.Alternatively, the I/O stack may be implemented using a thread-based orstack-based execution model. In one or more embodiments, the messagingkernel 370 allocates processing resources from the operating systemkernel 224 to execute the messages. Each storage I/O stack layer may beimplemented as one or more instances (i.e., processes) executing one ormore threads (e.g., in kernel or user space) that process the messagespassed between the layers such that the messages provide synchronizationfor blocking and non-blocking operation of the layers.

In an embodiment, the protocol layer 320 may communicate with the host120 over the network 130 by exchanging discrete frames or packetsconfigured as I/O requests according to pre-defined protocols, such asiSCSI and FCP. An I/O request, e.g., a read or write request, may bedirected to a LUN and may include I/O parameters such as, inter alia, aLUN identifier (ID), a logical block address (LB A) of the LUN, a length(i.e., amount of data) and, in the case of a write request, write data.The protocol layer 320 receives the I/O request and forwards it to thepersistence layer 330, which records the request into persistentwrite-back cache 380, illustratively embodied as a log whose contentscan be replaced randomly, e.g., under some random access replacementpolicy rather than only in serial fashion, and returns anacknowledgement to the host 120 via the protocol layer 320. In anembodiment, only I/O requests that modify the LUN (e.g., write requests)are logged. Notably, the I/O request may be logged at the node receivingthe I/O request, or in an alternative embodiment in accordance with thefunction shipping implementation, the I/O request may be logged atanother node.

Illustratively, dedicated logs may be maintained by the various layersof the storage I/O stack 300. For example, a dedicated log 335 may bemaintained by the persistence layer 330 to record the I/O parameters ofan I/O request as equivalent internal, i.e., storage I/O stack,parameters, e.g., volume ID, offset, and length. In the case of a writerequest, the persistence layer 330 may also cooperate with the NVRAM 280to implement the write-back cache 380 configured to store the write dataassociated with the write request. In an embodiment, the write-backcache may be structured as a log. Notably, the write data for the writerequest may be physically stored in the cache 380 such that the log 335contains the reference to the associated write data. It will beunderstood to persons skilled in the art that other variations of datastructures may be used to store or maintain the write data in NVRAMincluding data structures with no logs. In an embodiment, a copy of thewrite-back cache may be also maintained in the memory 220 to facilitatedirect memory access to the storage controllers. In other embodiments,caching may be performed at the host 120 or at a receiving node inaccordance with a protocol that maintains coherency between the datastored at the cache and the cluster.

In an embodiment, the administration layer 310 may apportion the LUNinto multiple volumes, each of which may be partitioned into multipleregions (e.g., allotted as disjoint block address ranges), with eachregion having one or more segments stored as multiple stripes on thearray 150. A plurality of volumes distributed among the nodes 200 maythus service a single LUN, i.e., each volume within the LUN services adifferent LBA range (i.e., offset and length, hereinafter offset range)or set of ranges within the LUN. Accordingly, the protocol layer 320 mayimplement a volume mapping technique to identify a volume to which theI/O request is directed (i.e., the volume servicing the offset rangeindicated by the parameters of the I/O request). Illustratively, thecluster database 244 may be configured to maintain one or moreassociations (e.g., key-value pairs) for each of the multiple volumes,e.g., an association between the LUN ID and a volume, as well as anassociation between the volume and a node ID for a node managing is thevolume. The administration layer 310 may also cooperate with thedatabase 244 to create (or delete) one or more volumes associated withthe LUN (e.g., creating a volume ID/LUN key-value pair in the database244). Using the LUN ID and LBA (or LBA range), the volume mappingtechnique may provide a volume ID (e.g., using appropriate associationsin the cluster database 244) that identifies the volume and nodeservicing the volume destined for the request, as well as translate theLBA (or LBA range) into an offset and length within the volume.Specifically, the volume ID is used to determine a volume layer instancethat manages volume metadata associated with the LBA or LBA range. Asnoted, the protocol layer 320 may pass the I/O request (i.e., volume ID,offset and length) to the persistence layer 330, which may use thefunction shipping (e.g., inter-node) implementation to forward the I/Orequest to the appropriate volume layer instance executing on a node inthe cluster based on the volume ID.

In an embodiment, the volume layer 340 may manage the volume metadataby, e.g., maintaining states of host-visible containers, such as rangesLUNs, and performing data management functions, such as creation ofsnapshots and clones, for the LUNs in cooperation with theadministration layer 310. The volume metadata is illustratively embodiedas in-core mappings from LUN addresses (i.e., offsets) to durable extentkeys, which are unique cluster-wide IDs associated with SSD storagelocations for extents within an extent key space of the cluster-widestorage container. That is, an extent key may be used to retrieve thedata of the extent at an SSD storage location associated with the extentkey. Alternatively, there may be multiple storage containers in thecluster wherein each container has its own extent key space, e.g., wherethe administration layer 310 provides distribution of extents among thestorage containers. As described further herein, an extent is a variablelength block of data that provides a unit of storage on the SSDs andthat need not be aligned on any specific boundary, i.e., it may be bytealigned. Accordingly, an extent may be an aggregation of write data froma plurality of write requests to maintain such alignment.Illustratively, the volume layer 340 may record the forwarded request(e.g., information or parameters characterizing the request), as well aschanges to the volume metadata, in dedicated log 345 maintained by thevolume layer 340. Subsequently, the contents of the volume layer log 345may be written to the is storage array 150 in accordance with acheckpoint (e.g., synchronization) operation that stores in-coremetadata on the array 150. That is, the checkpoint operation(checkpoint) ensures that a consistent state of metadata, as processedin-core, is committed to (i.e., stored on) the storage array 150;whereas retirement of log entries ensures that the entries accumulatedin the volume layer log 345 synchronize with the metadata checkpointscommitted to the storage array 150 by, e.g., retiring those accumulatedlog entries that are prior to the checkpoint. In one or moreembodiments, the checkpoint and retirement of log entries may be datadriven, periodic or both.

In an embodiment, the extent store layer 350 is responsible for storingextents to storage on the SSDs 260 (i.e., on the storage array 150) andfor providing the extent keys to the volume layer 340 (e.g., in responseto a forwarded write request). The extent store layer 350 is alsoresponsible for retrieving data (e.g., an existing extent) using anextent key (e.g., in response to a forwarded read request). The extentstore layer 350 may be responsible for performing de-duplication andcompression on the extents prior to storage. The extent store layer 350may maintain in-core mappings (e.g., embodied as hash tables) of extentkeys to SSD storage locations (e.g., offset on an SSD 260 of array 150).The extent store layer 350 may also maintain a dedicated log 355 ofentries that accumulate requested “put” and “delete” operations (i.e.,write requests and delete requests for extents issued from other layersto the extent store layer 350), where these operations change thein-core mappings (i.e., hash table entries). Subsequently, the in-coremappings and contents of the extent store layer log 355 may be writtento the storage array 150 in accordance with a “fuzzy” checkpoint 390(i.e., checkpoint with incremental changes recorded in one or more logfiles) in which selected in-core mappings (less than the total) arecommitted to the array 150 at various intervals (e.g., driven by anamount of change to the in-core mappings, size thresholds of log 355, orperiodically). Notably, the accumulated entries in log 355 may beretired once all in-core mappings have been checkpointed to include thechanges recorded in those entries.

In an embodiment, the RAID layer 360 may organize the SSDs 260 withinthe storage array 150 as one or more RAID groups (e.g., sets of SSDs)that enhance the reliability and integrity of extent storage on thearray by writing data “stripes” having is redundant information, i.e.,appropriate parity information with respect to the striped data, acrossa given number of SSDs 260 of each RAID group. The RAID layer 360 mayalso store a number of stripes (e.g., stripes of sufficient depth),e.g., in accordance with a plurality of contiguous range writeoperations, so as to reduce data relocation (i.e., internal flash blockmanagement) that may occur within the SSDs as a result of theoperations. In an embodiment, the storage layer 365 implements storageI/O drivers that may communicate directly with hardware (e.g., thestorage controllers and cluster interface) cooperating with theoperating system kernel 224, such as a Linux virtual function I/O (VFIO)driver.

Write Path

FIG. 4 illustrates an I/O (e.g., write) path 400 of the storage I/Ostack 300 for processing an I/O request, e.g., a SCSI write request 410.The write request 410 may be issued by host 120 and directed to a LUNstored on the storage array 150 of the cluster 100. Illustratively, theprotocol layer 320 receives and processes the write request by decoding420 (e.g., parsing and extracting) fields of the request, e.g., LUN ID,LBA and length (shown at 413), as well as write data 414. The protocollayer 320 may use the results 422 from decoding 420 for a volume mappingtechnique 430 (described above) that translates the LUN ID and LBA range(i.e., equivalent offset and length) of the write request to anappropriate volume layer instance, i.e., volume ID (volume 445), in thecluster 100 that is responsible for managing volume metadata for the LBArange. In an alternative embodiment, the persistence layer 330 mayimplement the above described volume mapping technique 430. The protocollayer then passes the results 432, e.g., volume ID, offset, length (aswell as write data), to the persistence layer 330, which records therequest in the persistence layer log 335 and returns an acknowledgementto the host 120 via the protocol layer 320. As described herein, thepersistence layer 330 may aggregate and organize write data 414 from oneor more write requests into a new extent 610 and perform a hashcomputation, i.e., a hash function, on the new extent to generate a hashvalue 650 in accordance with an extent hashing technique 600.Alternatively, the volume layer 340 may perform the hash computation togenerate the is hash value 650.

The persistence layer 330 may then pass the write request withaggregated write data including, e.g., the volume ID, offset and length,as parameters 434 to the appropriate volume layer instance. In anembodiment, message passing of the parameters 434 (received by thepersistence layer) may be redirected to anther node via the functionshipping mechanism, e.g., RPC, for inter-node communication.Alternatively, message passing of the parameters 434 may be via the IPCmechanism, e.g., message threads, for intra-node communication.

In one or more embodiments, a bucket mapping technique 700 is providedthat translates the hash value 650 to an instance 720 of an appropriateextent store layer (i.e., extent store instance 720) that is responsiblefor storing the new extent 610. Note, the bucket mapping technique maybe implemented in any layer of the storage I/O stack above the extentstore layer. In an embodiment, for example, the bucket mapping techniquemay be implemented in the persistence layer 330, the volume layer 340,or a layer that manages cluster-wide information, such as a clusterlayer (not shown). Accordingly, the persistence layer 330, the volumelayer 340, or the cluster layer may contain computer executableinstructions executed by the CPU 210 to perform operations thatimplement the bucket mapping technique 700 described herein. Thepersistence layer 330 may then pass the hash value 650 and the newextent 610 to the appropriate volume layer instance and onto theappropriate extent store instance via an extent store put operation. Theextent hashing technique 600 may embody an approximately uniform hashfunction to ensure that any random extent to be written may have anapproximately equal chance of falling into any extent store instance720, i.e., hash buckets are distributed across extent store instances ofthe cluster 100 based on available resources. As a result, the bucketmapping technique 700 provides load-balancing of write operations (and,by symmetry, read operations) across nodes 200 of the cluster, whilealso leveling flash wear in the SSDs 260 of the cluster.

In response to the put operation, the extent store instance may processthe hash value 650 to perform an extent metadata selection technique 800that (i) selects an appropriate hash table 850 (e.g., hash table 850 a)from a set of hash tables (illustratively is in-core) within the extentstore instance 720, and (ii) extracts a hash table index 820 from thehash value 650 to index into the selected hash table and lookup a tableentry having an extent key 810 identifying a storage location 530 on SSD260 for the extent. Accordingly, the extent store layer may containcomputer executable instructions executed by the CPU 210 to performoperations that implement the extent metadata selection technique 800.If a table entry with a matching key is found, then the SSD location 530mapped from the extent key 810 is used to retrieve an existing extent(not shown) from SSD. The existing extent is then compared with the newextent 610 to determine whether their data are identical. If the data isidentical, the new extent 610 is already stored on SSD 260 and ade-duplication opportunity (denoted de-duplication 452) exists such thatthere is no need to write another copy of the data. Accordingly, areference count in the table entry for the existing extent isincremented and the extent key 810 of the existing extent is passed tothe appropriate volume layer instance for storage within an entry(denoted as volume metadata entry 446) of a dense tree metadatastructure 444 (e.g., dense tree 444 a), such that the extent key 810 isassociated an offset range 440 (e.g., offset range 440 a) of the volume445.

However, if the data of the existing extent is not identical to the dataof the new extent 610, a collision occurs and a deterministic algorithmis invoked to sequentially generate as many new candidate extent keysmapping to the same bucket as needed to either provide de-duplication452 or to produce an extent key that is not already stored within theextent store instance. Notably, another hash table (e.g. hash table 850n) may be selected by a new candidate extent key in accordance with theextent metadata selection technique 800. In the event that node-duplication opportunity exists (i.e., the extent is not alreadystored) the new extent 610 is compressed in accordance with compressiontechnique 454 and passed to the RAID layer 360, which processes the newextent 610 for storage on SSD 260 within one or more stripes 464 of RAIDgroup 466.

The extent store instance may cooperate with the RAID layer 360 toidentify a storage segment 460 (i.e., a portion of the storage array150) and a location on SSD 260 within the segment 460 in which to storethe new extent 610. Illustratively, the identified storage segment is asegment with a large contiguous free space having, e.g., location 530 ison SSD 260 b for storing the extent 610.

In an embodiment, the RAID layer 360 then writes the stripes 464 acrossthe RAID group 466, illustratively as one or more full write stripes462. The RAID layer 360 may write a series of stripes 464 of sufficientdepth to reduce data relocation that may occur within flash-based SSDs260 (i.e., flash block management). The extent store instance then (i)loads the SSD location 530 of the new extent 610 into the selected hashtable 850 n (i.e., as selected by the new candidate extent key), (ii)passes a new extent key (denoted as extent key 810) to the appropriatevolume layer instance for storage within an entry (also denoted asvolume metadata entry 446) of a dense tree 444 managed by that volumelayer instance, and (iii) records a change to extent metadata of theselected hash table in the extent store layer log 355. Illustratively,the volume layer instance selects dense tree 444 a spanning an offsetrange 440 a of the volume 445 that encompasses the offset range of thewrite request. As noted, the volume 445 (e.g., an offset space of thevolume) is partitioned into multiple regions (e.g., allotted as disjointoffset ranges); in an embodiment, each region is represented by a densetree 444. The volume layer instance then inserts the volume metadataentry 446 into the dense tree 444 a and records a change correspondingto the volume metadata entry in the volume layer 345. Accordingly, theI/O (write) request is sufficiently stored on SSD 260 of the cluster.

Read Path

FIG. 5 illustrates an I/O (e.g., read) path 500 of the storage I/O stack300 for processing an I/O request, e.g., a SCSI read request 510. Theread request 510 may be issued by host 120 and received at the protocollayer 320 of a node 200 in the cluster 100. Illustratively, the protocollayer 320 processes the read request by decoding 420 (e.g., parsing andextracting) fields of the request, e.g., LUN ID, LBA, and length (shownat 513), and uses the decoded results 522, e.g., LUN ID, offset, andlength, for the volume mapping technique 430. That is, the protocollayer 320 may implement the volume mapping technique 430 (describedabove) to translate the LUN ID and LBA range (i.e., equivalent offsetand length) of the read request to an appropriate volume layer instance,i.e., volume ID (volume 445), in the cluster 100 that is responsible formanaging volume metadata for the LBA (i.e., offset) range. The protocollayer then passes the results 532 is to the persistence layer 330, whichmay search the write-back cache 380 to determine whether some or all ofthe read request can be serviced from its cached data. If the entirerequest cannot be serviced from the cached data, the persistence layer330 may then pass the remaining portion of the request including, e.g.,the volume ID, offset and length, as parameters 534 to the appropriatevolume layer instance in accordance with the function shipping mechanism(e.g., for RPC, for inter-node communication) or the IPC mechanism(e.g., message threads, for intra-node communication).

The volume layer instance may process the read request to access a densetree metadata structure 444 (e.g., dense tree 444 a) associated with aregion (e.g., offset range 440 a) of a volume 445 that encompasses therequested offset range (specified by parameters 534). The volume layerinstance may further process the read request to search for (lookup) oneor more volume metadata entries 446 of the dense tree 444 a to obtainone or more extent keys 810 associated with one or more extents 610within the requested offset range. In an embodiment, each dense tree 444may be embodied as multiple levels of a search structure with possiblyoverlapping offset range entries at each level. The various levels ofthe dense tree may have volume metadata entries 446 for the same offset,in which case, the higher level has the newer entry and is used toservice the read request. A top level of the dense tree 444 isillustratively resident in-core and a page cache 448 may be used toaccess lower levels of the tree. If the requested range or portionthereof is not present in the top level, a metadata page associated withan index entry at the next lower tree level (not shown) is accessed. Themetadata page (i.e., in the page cache 448) at the next level is thensearched (e.g., a binary search) to find any overlapping entries. Thisprocess is then iterated until one or more volume metadata entries 446of a level are found to ensure that the extent key(s) 810 for the entirerequested read range are found. If no metadata entries exist for theentire or portions of the requested read range, then the missingportion(s) are zero filled.

Once found, each extent key 810 is processed by the volume layer 340 to,e.g., implement the bucket mapping technique 700 that translates theextent key to an appropriate extent store instance 720 responsible forstoring the requested extent 610. is Note that, in an embodiment, eachextent key 810 may be substantially identical to the hash value 650associated with the extent 610, i.e., the hash value as calculatedduring the write request for the extent, such that the bucket mapping700 and extent metadata selection 800 techniques may be used for bothwrite and read path operations. Note also that the extent key 810 may bederived from the hash value 650. The volume layer 340 may then pass theextent key 810 (i.e., the hash value from a previous write request forthe extent) to the appropriate extent store instance 720 (via an extentstore get operation), which performs an extent key-to-SSD mapping todetermine the location on SSD 260 for the extent.

In response to the get operation, the extent store instance may processthe extent key 810 (i.e., hash value 650) to perform the extent metadataselection technique 800 that (i) selects an appropriate hash table 850(e.g., hash table 850 a) from a set of hash tables within the extentstore instance 720, and (ii) extracts a hash table index 820 from theextent key 810 (i.e., hash value 650) to index into the selected hashtable and lookup a table entry having a matching extent key 810 thatidentifies a storage location 530 on SSD 260 for the extent 610. Thatis, the SSD location 530 mapped to the extent key 810 may be used toretrieve the existing extent (denoted as extent 610) from SSD 260 (e.g.,SSD 260 b). The extent store instance then cooperates with the RAIDlayer 360 to access the extent on SSD 260 b and retrieve the datacontents in accordance with the read request. Illustratively, the RAIDlayer 360 may read the extent in accordance with an s extent readoperation 468 and pass the extent 610 to the extent store instance. Theextent store instance may then decompress the extent 610 in accordancewith a decompression technique 456, although it will be understood tothose skilled in the art that decompression can be performed at anylayer of the storage I/O stack 300. The extent 610 may be stored in abuffer (not shown) in memory 220 and a reference to that buffer may bepassed back through the layers of the storage I/O stack. The persistencelayer may then load the extent into a read cache 580 (or other stagingmechanism) and may extract appropriate read data 512 from the read cache580 for the LBA range of the read request 510. Thereafter, the protocollayer 320 may create a SCSI read response 514, including the read data512, and return the read response to the host 120.

Extent Hash Structure

FIG. 6 is a block diagram of the extent hashing technique 600 that maybe advantageously used with one or more embodiments described herein. Asnoted, the persistence layer 330 may organize the write data of one ormore write requests into one or more extents 610, each of which isembodied as a variable length block. The length of the extent may varybetween 1 byte and 64 KB (or larger) although, e.g., the extent istypically 4 KB or more in length. The extent 610 is illustratively alogically contiguous portion of a LUN (or file) that is storedphysically contiguous on SSD 260 within a node of the cluster so that,e.g., it can be read from the SSD in a single read operation. Thus,extents aggregated from multiple I/O requests may include contiguousoffset ranges within any LUN. Accordingly, multiple LUNs (and/or files)may share the same extent at different addresses (so long as logicallycontiguous within each LUN), because the extent generally does notmaintain information with respect to its presence in the storage pool ofthe cluster 100. As a result, two or more volume metadata entries mayinclude a same extent key.

In an embodiment, a random technique, such as a hash function 620 (e.g.,an approximately uniform hash), may be applied to each extent 610 togenerate a hash value 650 that is used to distribute (e.g., using theextent metadata selection technique) the write data (i.e., extent data)and associated metadata substantially evenly among the nodes 200 toenable fine-grain scale out and de-duplication 452 in the cluster 100.The hash computation is performed on the entire extent and may becomputed any time before the extent is passed to an extent storeinstance. Illustratively, the resulting hash value 650 may be used fortwo generally similar tasks. The first task is to distribute (spread)the extents and associated metadata evenly within each extent storeinstances. Thus, the hash value 650 is illustratively computed at thepersistence layer 330, but may be computed at or before the volume layer340 because the volume layer needs the hash value to determine theextent store instance of a node that services the extent.

The hash computation is illustratively performed in accordance with asecure hash algorithm, e.g., SHA-3 or Echo 256 cryptographic hashfunction, to generate a 256-bit is hash function result (not shown).Alternatively, hash algorithms, such as SipHash (secure 64-bit) orCityHash (non-crypto 64-bit) may be used. A portion, e.g., the lower 6bytes (48 bits), of the 256-bit hash function result may beillustratively trimmed, e.g., in accordance with a trim technique 640,to generate a 48-bit hash value 650. It will be apparent to thoseskilled in the art that the trimmed size of the hash value may beenlarged as the storage capacity of the cluster increases. In anembodiment, the trim technique 640 essentially truncates or severs the6-byte (48-bit) portion of the hash value 650 from the 32-byte hashfunction result. The resulting 6 bytes (48 bits) of the hash value 650are illustratively sufficient to enable the extent store instance tofind a representation of the location of the extent 610 on SSD 260 viaentries in the hash tables 850. In addition, the hash value 650illustratively enables its associated metadata, e.g., extent metadata inentries of the hash tables 850, to reside entirely in memory 220.However, a wider hash value (i.e., consuming more memory 220) may beused to improve the chances of performing de-duplication 452 of newextents without having to actually compare the write data of previousextents stored on SSD. The hash value 650 may be used to performaddress-like determinations within portions of its hash space inaccordance with various techniques, such as bucket mapping 700 andextent metadata selection 800 within the storage I/O stack 300, toselect the appropriate hash table 850 a for the extent 610.

FIG. 7 is a block diagram of the bucket mapping technique 700 that maybe advantageously used with one or more embodiments described herein. Asnoted, the hash value 650 may be computed at the persistence layer 330so as to enable efficient distribution of the extents 610 and associatedextent metadata evenly throughout the nodes 200 of the cluster. In anembodiment, the mapping technique divides (e.g., substantially evenly)the hash space of the 48-bit hash value 650 (i.e., 2⁴⁸) into bucketsthat, collectively, are representative of the extents and associatedextent metadata. A substantially equal number of buckets is thenassigned or mapped to each extent store instance of the nodes in thecluster 100 to thereby distribute ownership of the buckets, and thus theextents and extent metadata, substantially evenly, i.e., approximatelyuniformly, across all the extent store instances 720 of the nodes 200.Notably, the buckets may be alternatively assigned (or reassigned) byweighted distribution according to characteristics of the nodes such asstorage capacity and performance.

In an embodiment, the bucket mapping technique maps buckets to extentstore instances using a remainder computation 710 based on modulusarithmetic: the hash value divided by (modulo) the number of buckets,e.g., [hash value] mod [number of buckets]. Illustratively, the numberof buckets (i.e., divisors) is a prime, e.g., 65521 (the largest primeless than 2¹⁶), although those skilled in the art will recognize thatother divisors may be used in accordance with the embodiments describedherein. The results of the remainder computation may be organized as adata structure, such as a bucket mapping table 730, having 65521 bucketnumber entries, each of which maps to (references) an extent storeinstance. Alternatively, a bucket mapping data structure in the clusterdatabase 244 may be used to associate a bucket (number) 725, e.g.0-65520, to an extent store instance or node 200 to thereby map thecorresponding bucket to that extent store instance or node.

The buckets may be continually mapped to extent store instances and, asnew extents 610 are formed, they may be assigned to the buckets. Themappings from bucket numbers to extent store instances of the nodes areessentially arbitrary; a requirement may be that the number of bucketsserved by each extent store instance is proportional to the storagecapacity and processing bandwidth available in each node 200. Thebuckets 725 may be distributed among the extent store instances tothereby achieve a substantially even and balanced level of capacity andbandwidth utilization across all of the nodes in the cluster 100.

A new extent 610 may be subsequently formed at a node and applied to thehash function 620 to generate a result (as described above), which maybe trimmed using technique 640 to generate the hash value 650 to selectthe extent store instance for storing the new extent 610. The hash value650 may then be processed by the remainder computation 710 that dividesthe hash value by the number of buckets, e.g., [hash value] mod [numberof buckets], wherein the number of buckets is illustratively a prime,e.g., 65521. The result of the computation generates a bucket numberassociated with a bucket that functions as an index into a selectedentry of the bucket mapping table 730 to identify an extent storeinstance that serves the new extent associated with the hash value 650.Alternatively, the bucket mapping data structure of the cluster database244 may be searched using the bucket number as a key to identify anassociated value, i.e., an extent store instance or node 200, of akey-value pair. The hash value 650 may thereafter be passed to theextent store instance to enable selection of extent metadata used toidentify a location 530 of the extent on SSD 260.

Cuckoo Hashing

The embodiments described herein are directed to the use of hashing in afile system metadata arrangement that reduces an amount of metadatastored in a memory of a node in a cluster and that reduces the amount ofmetadata needed to process an I/O request at the node. Illustratively,the embodiments are directed to cuckoo hashing and, in particular, to amanner in which cuckoo hashing may be modified and applied to constructthe file system metadata arrangement. In an embodiment, the file systemmetadata arrangement may be illustratively configured as a key-valueextent store embodied as a data structure, e.g., a cuckoo hash table,wherein a value, such as a hash table index, may be applied to thecuckoo hash table to obtain a key, such as an extent key, configured toreference a location of an extent on one or more storage devices, suchas SSDs. Thus, the cuckoo hash table embodies extent metadata thatdescribes the extent and, as such, may be organized to associate alocation on SSD with an index, i.e., a value associated with the hashtable index identifies the location on SSD. Advantageously, the filesystem metadata arrangement achieves a high degree of metadatacompactness, thus reducing read and write amplification as well asmemory requirements.

In an embodiment, storage and retrieval of key-value pairs employ cuckoohashing, i.e., the set of cuckoo hash tables, using a portion of thehash value 650 as a hash table index (i.e., indexing into the cuckoohash table), which is illustratively split in half. Each half of thehash table index may be used as an index into each cuckoo hash table todetermine a potential entry for storing the other half of the hash tableindex in the table. That is, one half of the hash table index may beused as the index into the cuckoo hash table, while the other half maybe used as the value stored in the hash table. Alternatively, the otherhalf of the hash table index may be used as the index, while the onehalf may be used as the stored value. Thus, the same hash table indexcan be stored in the cuckoo hash table in two different ways, i.e.,either in an upper half or lower half of the cuckoo hash table. Thisallows higher population, i.e., load factor, in the hash table withoutchaining, e.g., the use of linked lists, by accessing an entry with theone half of the hash table index as the index and, if the entry isoccupied, accessing another entry with the other half of the hash tableindex as the index. Accordingly, cuckoo hashing reduces an amount ofmetadata (i.e., the hash table index) stored in the memory of the nodeas a result of a higher load factor. If both entries are occupied, thenone of the two entries is chosen and the prior content of the entry maybe evicted and re-inserted into the cuckoo table at an alternatelocation (i.e., alternate entry) using the prior content as an alternateindex to the hash table, i.e., not resolving to either of the twoentries. The hash table index, i.e., referencing the chosen entry, maythen be stored at the alternate location. If the alternate location alsois occupied, the prior content of the alternate entry may also beevicted. This eviction process may be repeated until an unoccupied entryis found.

However, as full capacity (i.e., load) of the hash table is approached,a cycle effect may be realized wherein two or more entries chaintogether through their present and alternate hash table locations toform a complete cycle; if this occurs, no new insertions can occur atany of these locations. To reduce (i.e., practically eliminate) thisproblem, the cuckoo hash table embodies a set associative organizationsuch that, for each entry that is indexed by half of the hash tableindex, there is a plurality of possible slots (i.e., a group of slotsassociated with the index) into which the other half of the hash tableindex may be inserted/stored, i.e., all of the slots are associated withthe indexing hash table index (i.e., the hash table index used to indexthe group of slots), but each slot may include a different other half ofthe hash table index. Generally, a free slot of the plurality ofpossible slots may be found by linear search of the plurality of slotsfor the non-indexing half of the hash table index, i.e., if K1 indexesfor the entry/slot, a search for K2 is performed. Alternatively, theassociative set may be sorted permitting a more efficient search, e.g.,a binary search, to be used. Note that a number of searches for a freeslot may be limited (e.g., maximum of three entries evicted) before ahash table is deemed too full to store the key.

In an embodiment, the cuckoo hash table may be organized with a 32-wayset associativity, i.e., the hash table index stored in the cuckoo hashtable may be found in any of 32 slots of the hash table indexed at theone half of the hash table index or any of 32 slots indexed by the otherhalf of the hash table index. If an adequately uniform hash function isused, the distribution may be sufficiently balanced such that there maybe un-occupied slots for any particular hash value. That is, as long asthe entire hash table is not full, one of the 64 potential slots for thehash table index is likely to be unoccupied so that the hash table indexcan be inserted into that slot. If all 64 slots are occupied, it islikely that one of the 64 occupants can be moved to an empty entry/slotwithout any further relocation. Note that every time contents are movedfrom one entry/slot to another in the hash tables, the entrycorresponding to hash table index 820 may be logged to record changes(i.e., updates) to the hash table. Advantageously, the 32-way setassociativity may provide a load factor greater than 98%, so that valuesinserted into the hash table remain in the slots/entries and are notpushed out by the cuckoo hashing until the table is substantially full.By using the cuckoo hash, two possible entries for an extent key in thehash table can be directly computed and the 64 slots associated with theentries can be inspected, i.e., searched, to find the extent key.Illustratively, entries of the cuckoo hash table may be sized so thatall 32 slots for the hash table index fit in a cache line of the CPU 210enabling a fast linear search of the slots.

Hash Table Organization

FIG. 8a is a block diagram of a cuckoo hash table that may beadvantageously used with one or more embodiments described herein. In anembodiment, the extent metadata resides entirely in the memory 220 ofeach node 200 and is embodied as a hash table 850 a-n of a set of hashtables 860 configured to address locations of the SSD. Note that thebucket mapping technique 700 ensures that the buckets assigned to theextent store instances are substantially evenly populated with extentmetadata such that each bucket contributes equally to the hash tablesserved by an extent store instance, i.e., the bucket mapping technique700 has an approximately uniform distribution. The extent store instancemay use the hash value 650 to provide the extent metadata selectiontechnique 800. To that end, the contents of the 48-bit (6 byte) hashvalue, i.e., the hash value 650, are illustratively organized into thefollowing fields (in no particular order): an 8-bit field used as anindex to select a hash table, i.e., one of 256 tables, from the set ofhash tables (“hash table selector” 804), an 8-bit field used for, interalia, bucket selection and hash table selection (“extra key bits” 802),and two 16-bit fields used as indices to entries 840 a-b (i.e., group ofslots) in the selected hash table (“K2” 806 and “K1” 808). Each hashtable 850 includes two halves where each half is addressable by one ofthe 16-bit indices (e.g., “K1” and “K2”), so that each table half mayinclude 65536 (i.e., 2¹⁶) entries 840. Note, the hash table index 820 isdetermined from K1 and K2 depending on which half of the hash table isindexed. Further, each entry 840 a-b is a 32-way associative set ofslots 830 having the key-value pair. Accordingly, there are 2¹⁶×32×2(i.e., entries x associatively×2 table halves)=4 M (4,194,240) totalentries/slots (“slots”) per hash table and at least 256 tables, i.e.,hash table selector 804, per extent store instance, yielding a billion(1,073,725,440 exactly) slots. Notably, the hash table set may befurther expanded into subsets selected based on a function applied tothe hash value 650 (e.g., computing a remainder of the hash value 650for a prime number as an index to a subset of the hash table set 860),an exemplary embodiment of which is described in commonly owned U.S.patent application Ser. No. 14/044,624 titled Extent Hash Structure forStorage System by Kimmel et el., filed on Oct. 2, 2013.

FIG. 8b is a block diagram of a hash table slot 830 that may beadvantageously used with one or more embodiments described herein.Illustratively, the slot is organized as a 10-byte (80-bit) value havingthe following fields: a 5-byte (i.e., 40-bit) offset 831 indicating alocation on SSD for an extent “keyed” by the slot; a 1-byte (8-bit)length 832 indicating a size of the extent; a reference count having atleast 7-bits (“refcount” 834) indicating a number of metadata referencesto the extent; a dirty bit 836 indicating whether the slot has beenchanged, i.e., is “dirty”; the extra key bits 802 from the hash value650 for the extent; and either “K1” 808 or “K2” 806 not used as the hashtable index 820 to index to the entry 840. Note that the length field832 may represent a number of sectors of a given size based on thegeometry of the SSD 260, e.g., 512 bytes or 520 bytes, such that a1-byte length may represent a range of 255×512 bytes=128K bytes.Accordingly, an extent may vary from 512 bytes to 128K bytes in 512 byteincrements.

In an embodiment, combinations of sentinel values in one or more fieldsof the slot 830 may be used to indicate a type of extent, such as i) a“hole” or deleted extent and ii) a “put” or stored extent. For example,a refcount 834 of zero and offset 831 of zero may be used to indicate adeleted extent, whereas a refcount 834 greater than zero (i.e., one) andoffset 831 other than zero may be used to indicate a stored extent.Compactness of the slot fields benefits efficient use of memory as it isdesirable to maintain the hash tables in-core for fast lookup ofkey-value pairs, i.e., locations of extents from hash keys. For example,the previously calculated 1 billion slots may consume 10 GB in-core,i.e., 10-bytes per slot, not including any expansion (e.g., theexpansion technique in an exemplary embodiment in aforementioned U.S.patent application Extent Hash Structure for Storage System multipliesthe in-core consumption by 3). Notably, each extent store instance maysupport a LUN capacity of at least 4 terabytes (TB) based on a minimum 4KB extent size (1 B×4 KB per extent) to a maximum of 384 TB based on a128 KB extent size with hash table expansion (1 B×3 expansion×128 KB perextent).

In an embodiment, there are illustratively 768 hash tables in the hashtable set 860, wherein each hash table 850 has a same size, e.g.,approximately 4 million entries. Illustratively, the number of hashtables may be determined by multiplying the 8 bits of the hash tableselector (2⁸ or 256) by a prime (3) such that 256×3=768. Note that ifmore than 768 tables are needed, then the multiplier to 256 may be aprime that is larger than 3, e.g., 5×256 equaling 1280 tables. Therandomness, i.e., approximately uniform distribution, of the 48-bit hashvalue 650 may be relied upon to spread the metadata evenly among thehash tables 850.

The hash table selector 804 may thereafter be used to select anappropriate in-core hash table 850 having an extent key 810 that is usedto map to a SSD location to determine whether the extent 610 ispresently served by the selected extent store instance. Illustratively,the appropriate hash table 850 is selected by dividing (modulo) theentire 48-bit hash value 650 by a prime divisor, e.g., 3, to generate aremainder (between 0-2) and multiplying the 8-bit value of the hashtable selector by 3 to generate a value that is then added to theremainder, i.e., 3×[hash table selector 804]+[hash value 650] mod 3. Itshould be noted that, in general, the 48-bit hash value 650 may beoverloaded with prime divisors to obtain various hash table indices toaddress varying amounts of hash tables 850. The 768 hash tablesrepresent a number of tables that can reasonably fit in memory 220.

Once a hash table 850 a is selected, the extent store instance mayextract either K1 or K2 of the hash value 650 for use as the hash tableindex 820 to index into the hash table (e.g., using K1 for the upperhalf of the table and K2 for the lower half of the table) and select anappropriate entry 840 a configured to store, inter alia, a portion ofthe extent key 810, as well as an identification of location on SSD.Notably, K1 and K2 are distinguished from each other using an impliedhigh-order bit that splits the cuckoo hash table into an upper addressspace and a lower address space. Illustratively, the implied high-orderbit increases the address capability of K1 or K2 from 2¹⁶ possiblelocations to 2¹⁷ possible locations, where the upper address space ofthe hash table is addressable by one 16-bit field (e.g., K1) of the hashvalue and a lower address space of the hash table is addressable by theother 16-bit field (e.g., K2). In an embodiment, the selection of whichhash table index (K1 or K2) to use to initially index into cuckoo hashtable is arbitrary. Illustratively, a lower-order bit of the hash value(e.g., mod 2) may be used to select which hash table index to use. Inthe case of an insertion of an entry (e.g., storing an extent) into thecuckoo hash table 850 a, a desired approach may be to choose whicheverupper or lower address space set is less occupied (after an exhaustivesearch of both sets 840 a and 840 b).

As noted, each cuckoo hash table has set-associative slots, e.g., 32slots per associative set. In an embodiment, there is no ordering of the32 slots within the associative set of an entry; a linear search may beperformed to find an empty slot for inserting an extent key.Alternatively, the slots may be ordered to accommodate a faster search,e.g., binary search, especially for larger associative sets (e.g., 128way), which may not fit into a CPU cache line. Similarly, once theassociative set of slots is identified, i.e., as entry 840, that couldhold the extent key, the linear search may be performed within the slotsto determine whether the key is present. The advantage of the cuckoohash table is that there are exactly 2 entries (each having 32 slots) inthe entire cluster 100 at which a given extent key value can reside.Once the entry is indexed using K1 or K2 along with the impliedhigh-order bit, there are 32 slots within the entry 840 to search.

In an embodiment, the number of slots per entry 840 is illustrativelychosen as 32, because all 32 slots can fit into a cache line of, forexample, an Intel processor (i.e., 32×size of the hash table index 820in the slot). In other words, 16 bits or 2 bytes (K1 or K2) times the 32slots equals 64 bytes, which is the size of an illustrative cache line.Once an operation fetches and manipulates a cache line, the cache lineremains cached until it is evicted. For a linear search of the cachedslots 830, no further fetch from memory may be required, thus avoidingany eviction of previously cached slots for the entry 840.Illustratively, the size of the set (i.e., 32 slots) is arbitrary andchosen so as to fit in the cache line. Without changing any of thealgorithms for accessing a given set, i.e., entry 840, the set sizecould be changed to an arbitrary integer and even vary per set. Theinformation constituting the remaining 8 bytes of an entry (includingthe offset 831 which constitutes part of the extent location 530 on SSD)may be stored out-of-line, i.e., not cached during the search of slots,in another portion of the hash table 850. It should be noted that thehash table 850 may be stored in column major order in memory (e.g.,defining the hash table in the “C” programming language as a structureincluding the fields of the slot 830 as separate arrays). Thus, if it isdesirable to access the K1 or K2 16-bit field, only one cache lineaccess may be required.

To ensure fast and efficient performance, the hash table 850 may befurther organized to require only one disk (SSD) access for every extentobtained from the extent store instance. This is possible because theextent store layer 350 of the storage I/O stack 300 does not have theoverhead of a directory hierarchy organization and, therefore, when anI/O request is forwarded to the extent store instance, a fast lookup inmemory 220 may occur to the appropriate in-core hash table 850 and thenthe SSD(s) are accessed just once. Thus, there may be only one SSDaccess per I/O (read or write) operation, thereby improving read and/orwrite amplification.

FIG. 9 is a block diagram of an extent key reconstruction technique thatmay be advantageously used with one or more embodiments describedherein. Extent key reconstruction aids efficient reassignment (i.e.,migration) of a bucket (number) 725 (e.g., via the bucket mapping table730) from a first extent store instance to a second extent storeinstance. For example, hash tables 850 of the first extent storeinstance may be searched for slots associated with the bucket to bereassigned, and those slots may then be re-inserted into the hash tablesof the second extent store instance using extent keys reconstructed fromeach respective slot found from the search of the first extent storeinstance.

Illustratively, reconstruction of an extent key is based, in part, onthe contents of a hash table slot 830 a,b to thereby permit storage inthe slot of only those bits of the hash value 650 required to identify,i.e., search, for the slot and reconstruct the hash value 650 (i.e., thesubstantially identical extent key 810). In an embodiment, the extentstore layer 350 contains computer executable instructions executed bythe CPU 210 to perform operations that implement the extent keyreconstruction technique described herein. According to the technique,once the slot 830 a,b is found, the 16-bit field (e.g. K1 or K2) can bediscarded (is not stored) because the extent store layer (instance) canrecreate the 16-bit field implicitly from the entry 840 a,b in the upperaddress space portion 902 or lower address space portion 904 of the hashtable 850. That is, use of bits from the hash value for a portion of theindexing enables inferential determination of the bits instead of havingto store them. In addition, the 8 bits of hash table selector 804 do notneed to be stored and can be recreated implicitly from the accessed hashtable itself, i.e., determining a slot 830 a,b implies having indexedinto the appropriate hash table. Thus, only 2 bytes of the hash value650 bits not implied by the index (i.e., K1 or K2) and 1 byte of extrakey bits 802 need be stored in the slot 830 a,b. Specifically, in orderto reproduce the 6-byte (48-bit) hash value 650 (i.e., the extent key810), 2 bytes of cuckoo indexing are inferred (not stored) by the entryin the table, 2 bytes of cuckoo indexing are stored in memory, one byteof the hash value is inferred (not stored) by the hash table selector ofthe hash table set, and finally one byte is stored in memory as extrabits. As a result, it is only necessary to store 3 bytes or 24 bits ofhash value 650 (i.e., K1 or K2, plus the extra key bits 802) in the slot830 a,b of the hash table in order to reconstruct the hash value, i.e.,the extent key 810. In an embodiment, the extra key bits 802 may be usedto realize sufficient uniqueness in the event of a collision.

Perturb Key Technique

The embodiments described herein are directed to a technique forperturbing an original extent key to compute a candidate extent key thatis not previously stored in an extent store instance. The candidateextent key may be computed from a hash value of an extent using aperturbing algorithm, i.e., a hash collision computation, whichillustratively adds (or subtracts) a perturb value (i.e., a perturbingnumber) to the hash value. The perturb value is illustrativelysufficient to ensure that the candidate extent key resolves to the samenode (extent store instance) and hash bucket as the original extent key.In essence, the technique ensures that the original extent key isperturbed in a predictable (i.e., deterministic) manner to generate thecandidate extent key, so that the original extent and candidate extentkey “decode” to the same hash bucket and extent store instance.Accordingly, the technique embodies a deterministic function to select anew (i.e., different) candidate extent key that still maps (i.e.,decodes) to a same hash bucket. Note that because a same hash collisionis resolved in a same predictable way (i.e., using the deterministicfunction) each time that the collision occurs, it is more likely (i.e.,increases a probability) that an extent having a colliding extent keywill deduplicate a preexisting copy of that extent (i.e., an identicalextent).

FIG. 10 is a block diagram of the perturb key technique that may beadvantageously used with one or more embodiments described herein.Illustratively, the perturb key technique employs a perturb computation1002 to determine a unique candidate extent key 811 (having a candidatehash table index 820 b) in the event of a collision, i.e., the hashtable index 820 a collides with a slot 830 a matching the combination ofthe extra key bits 802 and either K1 or K2, whichever is found in thatfield of the slot. As used herein, a collision arises when an entry isproperly indexed by the hash table index 820 a of the 48-bit hash value650 into the hash table 850 a, but a comparison reveals that a differentextent (i.e., having different data) already has allocated the candidateextent key, i.e., the slot 830 a is occupied by a different extent withextra key bits 802 and either K1 or K2 (whichever is found in that fieldof the slot) matching those of the candidate extent key. It should benoted that proper indexing into the hash table involves indexing intoboth the upper address space portion 902 and the lower address spaceportion 904 of the hash table 850 (using, e.g., K1 and K2 respectively),as an extent using the candidate extent key may already reside in eitherportion. Illustratively, the collision occurs as a result of a failedde-duplication opportunity (i.e., two extents having different data thatyield identical hash values) and the need to choose a new hash value(i.e., the candidate extent key 811). That is, the hash value 650 isinsufficient and, as a result, the candidate extent key 811 along withthe concomitant candidate hash table index 820 b may be generated.Accordingly, the candidate extent key 811 is generated such that itdiffers from the hash value 650, e.g., the hash table index 820 b of thecandidate extent key may reference a (new) different hash table entry840 b from that (entry 840 a) referenced by the table index 820 a of thehash value. Illustratively, the new entry 840 b (and new slot 830 n) inthe hash table set 860 may be determined from the candidate extent key811 computed from the hash value 650 such that the candidate extent key811 resolves to a same (i.e., single) bucket number as that for the hashvalue 650. Notably, the new entry 840 b may be 1) the same entry 840 a(i.e., the hash table index 820 a of the hash value is identical to hashtable index 820 b of the candidate extent key, but respective extra keybits, K1, or K2 differ), 2) found in a same hash table 850 a as theentry 840 a or 3) found in another hash table 850 n of the hash tableset. However, both the candidate extent key 811 and the hash value 650differ and resolve to the same bucket number, while also resolving to(possibly) different entries 840 a,b in the hash table set 860. Note,resolving to a same bucket number also resolves to the same extent storeinstance (i.e., via bucket mapping table using the bucket number) aseach bucket is mapped to a single extent store instance.

In an embodiment, the candidate extent key 811 may be computed from thehash value 650 using the deterministic algorithm, i.e., the perturbcomputation 1002, which illustratively adds or subtracts a perturbingnumber 1020 to/from the hash value 650 so that different entry 840 inthe hash table set 860 may be used. As noted, the candidate extent keyis computed to resolve to the same hash bucket (i.e., bucket number)within an extent storage instance as the hash value. Additionally, thecandidate extent key and hash value resolve to the same hash table set.Accordingly, the candidate extent key and hash value “decode” as per theI/O read path to a same hash table set, so that the collision canresolved by the service associated with that same hash table set. Thatis, the bucket mapping technique 700 and metadata selection 800 appliedto the candidate extent key or to the hash value select the same hashbucket (via bucket mapping technique 700) and the same hash table set(via metadata selection technique 800). Thus, the hash value of theextent (i.e., associated with candidate extent key) is sufficientlycongruent with the candidate extent key, so that a same table entry 840may be determined for the candidate extent key and the hash value forthe extent. As such, the hash value and candidate extent key arecongruent as to 1) bucket number (and extent store instance) and 2) hashtable selector. Note that the candidate extent key is also checked for acollision and, if so, subsequent candidate extent keys may be generated(e.g., by recursively applying the perturb key technique describedherein) until no collision occurs (i.e., the candidate key does notcollide with the original extent key or any other extent key).

The perturb key technique thus adds or subtracts a sufficient value(i.e., perturbing number) to the hash value (i.e., compute the candidateextent key) to ensure that the candidate extent key selects the samenode (i.e., same bucket number and extent store instance), as well asthe same hash table set, as selected by the hash value. That is, thecandidate extent key and hash value have the same 1) bucket number andnode and 2) the same hash table selector, i.e., the high-order byte ofthe hash value.

Assume that a portion of the hash value, e.g., a lower-order bitsportion (lower-order portion), has a value that is at an upper range ofthe lower-order portion (e.g., all hexadecimal Fs). Adding theperturbing number (PN) to the upper-range value of the lower-orderportion would result in an overflow (or wrap) to an adjacent field,i.e., a high-order portion, of the hash value (e.g., overflow of theextra key bits field into the hash table selector field). Such overflowwould disrupt (not preserve) the mod function, i.e., the resulting hashvalue may select a different hash table set. Similarly, if the PN issubtracted from the lower-order portion having a lower-range value(e.g., all 0's), the result would underflow. To avoid the overflow orunderflow situation, if the value of the lower-order portion isrelatively small (e.g., less than 128), the PN is added to the hashvalue, and if the value of the lower-order of the hash value portion isrelatively large (e.g., greater than 127), the PN is subtracted from thehash value. That is, if the hash table index 820 (i.e., lower-order ofthe hash value portion) of the hash value is greater than the mid-pointof its range, the PN is subtracted from the hash value, and if the hashtable index 820 of the hash value is less than or equal to the mid-pointof its range, the PN is added to the hash value. Accordingly, the hashtable index of the candidate extent key is prevented from underflow andoverflow.

Assume now that the value of the lower-order portion is neitherrelatively small nor large, but rather approximately in the middle(i.e., near the center point) of the range of values, such that a firstperturbation of the hash value adds the PN (i.e., a first perturbingnumber 1020), causing the resulting value (i.e., candidate extent key)to be relatively large. If the candidate key remains in collision, anext perturbation of the candidate extent key then subtracts the PN,causing the result to oscillate back below the center point and cluster(i.e., “crowd”) candidate extent keys around the center point. As aresult, the candidate extent key maintains the approximately uniformdistribution of extent keys within the hash tables.

For example, if the range of lower-order portion values is 2⁴⁰, apredictable large random number (e.g. 2²⁴) may be added to the hashvalue to move far away from the center point and avoid the risk ofoscillating back and forth across the center point. To maintain the samebucket number for the hash value and candidate extent key as applied bythe bucket mapping technique (i.e., computation remainder 710), aninteger multiple of the number of buckets (e.g., 65521) (and tableexpansion) may be used as the pseudo random number 1010. Illustratively,the multiple may be computed from a pseudo-random 16-bit number added tothe lower order bytes of the hash value. As noted, the bucket-to-extentstore instance mapping involves dividing the hash value by a large primenumber (65521) to arrive at the bucket number 725. Adding the largepseudo random number (PSN) to the hash value moves sufficiently far awayfrom the center point such that after an initial addition (increment) ofthe PSN, only subsequent subtractions of the PN are needed to computesubsequent candidate extent keys. Alternatively, subtracting the PSN mayalso move far away from the center point such that only subsequentadditions of the PN are needed to compute subsequent candidate extentkeys. This aspect of the technique ensures that an unused candidateextent key will be resolved before ever reaching the center point.

Notably, a distinguishing aspect of the perturb technique is theaddition/subtraction of the PN if below/above the center point of thehash table index, e.g., to avoid the wrap problem. The inclusion of thelarge pseudo random number (PSN) addresses a hysteresis problem andavoids oscillating around the center point by moving far away from thecenter point (midpoint) to avoid “crowding” of the keys around themidpoint space. Perturbing may create an uneven distribution of keys; byadding the large pseudo random number, the candidate extent keys (i.e.,perturbed keys) may be more evenly distributed so as to likely fill upthe hash tables evenly.

While there have been shown and described illustrative embodimentsdirected to a technique for perturbing an original extent key to computea candidate extent key that is not previously stored in an extent storeinstance, it is to be understood that various other adaptations andmodifications may be made within the spirit and scope of the embodimentsherein. For example, embodiments have been shown and described hereinwith relation to employing the perturb computation 1002 to determine aunique candidate extent key in the event of a collision. However, theembodiments in their broader sense are not so limited, and may, in fact,allow for use of the perturb key technique to avoid a lack of anavailable slot 830 in a hash table entry 840. Recall that a hash tableindex 820 references an entry 840 in either the upper or lower half of ahash table, where each entry includes a number (e.g., 32) of slots 830(i.e., 32 way association). Thus an extent key (i.e., hash value) canonly reference and be stored in the referenced slots of the hash tableentry, even though the other entries/slots of the hash table may beempty. If all of those slots are occupied, i.e., the hash function 620generates and stores the number of keys that map to those slots, thenthe key cannot be stored in the table and the perturbed key techniquedescribed herein may be applied to select a different hash table entryto resolve this situation.

The foregoing description has been directed to specific embodiments. Itwill be apparent, however, that other variations and modifications maybe made to the described embodiments, with the attainment of some or allof their advantages. For instance, it is expressly contemplated that thecomponents and/or elements described herein can be implemented assoftware encoded on a tangible (non-transitory) computer-readable medium(e.g., disks, electronic memory, and/or CDs) having program instructionsexecuting on a computer, hardware, firmware, or a combination thereof.Accordingly this description is to be taken only by way of example andnot to otherwise limit the scope of the embodiments herein. Therefore,it is the object of the appended claims to cover all such variations andmodifications as come within the true spirit and scope of theembodiments herein.

What is claimed is:
 1. A method comprising: receiving first and secondextents at a storage system having a processor and a memory, the storagesystem coupled to a storage device, the first extent different from thesecond extent; applying a hash function to generate first and secondkeys associated respectively with the first extent and second extents,the first key mapping to a first hash bucket selected from among a setof approximately uniformly distributed hash buckets, the second keymapping to a second hash bucket selected from among the set ofapproximately uniformly distributed hash buckets; determining whetherthe second key collides with the first key; in response to determiningthat the second key collides with the first key, perturbing the secondkey using a deterministic function to generate a candidate key such thatthe second hash bucket is identical to the first hash bucket andassociating the candidate key with the second extent; and storing thefirst and second extents on the storage device.
 2. The method of claim 1wherein perturbing the second key using the deterministic function togenerate the candidate key further comprises: determining whether thecandidate key collides with the first key; and in response todetermining that the candidate key collides with the first key,perturbing the candidate key repeatedly until the first key does notcollide with the candidate key.
 3. The method of claim 1 wherein thestorage device is a solid state drive.
 4. The method of claim 1 whereinmapping the first key to the first hash bucket uses an arithmeticremainder function.
 5. The method of claim 2 wherein the deterministicfunction performs one of addition and subtraction of an integer multipleof a number of hash buckets included in the set of approximatelyuniformly distributed hash buckets.
 6. The method of claim 1 furthercomprising: mapping the first key to a set of hash tables having theassociation of the first key to the first extent and having theassociation of the candidate key to the second extent; and mapping thecandidate key to the set of hash tables.
 7. The method of claim 6wherein mapping the first key and candidate key to the set of hashtables uses of a same field of bits from the first key and candidate keyrespectively.
 8. The method of claim 1 wherein the storage systemincludes a plurality of nodes, and wherein each hash bucket is mapped toa respective node of the plurality of nodes.
 9. The method of claim 1wherein the deterministic function increases a probability thatidentical extents are deduplicated.
 10. A method comprising: receivingfirst and second extents at a storage system having a processor and amemory, the storage system coupled to a storage device, the first extentdifferent from the second extent; applying a hash function to generatefirst and second keys associated respectively with the first and secondextents, the first key mapping to a first hash bucket selected fromamong a set of approximately uniformly distributed hash buckets, thesecond key mapping to a second hash bucket selected from among the setof approximately uniformly distributed hash buckets; determining whetherthe second key collides with the first key; in response to determiningthat the second key collides with the first key, perturbing the secondkey using a deterministic function to generate a candidate key such thatthe second hash bucket is identical to the first hash bucket andassociating the candidate key with the second extent, wherein thedeterministic function increases a probability that identical extentsare deduplicated; determining whether the candidate key collides withthe first key; in response to determining that the candidate keycollides with the first key, perturbing the candidate key repeatedlyuntil the first key does not collide with the candidate key; and storingthe first and second extents on the storage device.
 11. A systemcomprising: a storage system having a node including a memory connect toa processor via a bus; a storage array coupled to the storage system; astorage I/O stack executing on the processor of the storage system, thestorage I/O stack when executed operable to: receive first and secondextents, the first extent different from the second extent; apply a hashfunction to generate first key and second keys associated respectivelywith the first extent and second extents, the first key mapping to afirst hash bucket selected from among a set of approximately uniformlydistributed hash buckets, the second key mapping to a second hash bucketselected from among the set of approximately uniformly distributed hashbuckets; determine whether the second key collides with the first key;in response to determining that the second key collides with the firstkey, perturb the second key using a deterministic function to generate acandidate key such that the first hash bucket is identical to the secondhash bucket and associating the candidate key with the second extent;and storing the first and second extents on the storage array.
 12. Thesystem of claim 11 wherein the storage I/O stack operable to perturb thesecond key using the deterministic function to generate the candidatekey further comprises: determine whether the candidate key collides withthe first key; and in response to determining that the candidate keycollides with the first key, perturb the candidate key until the firstkey does not collide with the candidate key.
 13. The system of claim 11wherein the storage array includes one or more solid state drives. 14.The system of claim 11 wherein mapping the first key to the first hashbucket uses an arithmetic remainder function.
 15. The system of claim 12wherein the deterministic function performs one of addition andsubtraction of an integer multiple of a number of hash buckets includedin the set of approximately uniformly distributed hash buckets.
 16. Thesystem of claim 11 wherein the storage I/O stack is further operable to:map the first key to a set of hash tables having the association of thefirst key to the first extent and having the association of thecandidate key to the second extent; and map the candidate key to the setof hash tables.
 17. The system of claim 16 wherein mapping the first keyand candidate key to the set of hash tables uses of a same field of bitsfrom the first key and candidate key respectively.
 18. The system ofclaim 11 wherein the storage system includes a plurality of nodes, andwherein each hash bucket is mapped to a respective node of the pluralityof nodes.
 19. The system of claim 11 wherein the deterministic functionincreases a probability that identical extents are deduplicated.
 20. Thesystem of claim 15 wherein the number of hash buckets included in theset of approximately uniformly distributed hash buckets is a primenumber.